public class Circle implements Cloneable {
    private Point p;
    private int R;

    public Circle(Point p, int R) {
        this.p = p;
        this.R = R;
    }

    public Point getP() {
        return p;
    }

    public void setP(Point p) {
        this.p = p;
    }

    public int getR() {
        return R;
    }

    public void setR(int R) {
        this.R = R;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        // 创建一个新的Circle对象
        Circle clonedCircle = (Circle) super.clone();

        // 克隆Point对象
        Point clonedPoint = (Point) p.clone();

        // 将克隆的Point对象赋值给克隆的Circle对象的p属性
        clonedCircle.setP(clonedPoint);

        return clonedCircle;
    }

    public static void main(String[] args) {
        Point center = new Point(3, 4);
        Circle circle1 = new Circle(center, 5);

        try {
            Circle circle2 = (Circle) circle1.clone();

            // 修改原对象的属性
            circle1.getP().setX(10);
            circle1.setR(8);

            // 打印原对象和克隆对象的属性
            System.out.println("原对象：");
            System.out.println("Center: (" + circle1.getP().getX() + ", " + circle1.getP().getY() + ")");
            System.out.println("Radius: " + circle1.getR());

            System.out.println("克隆对象：");
            System.out.println("Center: (" + circle2.getP().getX() + ", " + circle2.getP().getY() + ")");
            System.out.println("Radius: " + circle2.getR());
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
    }
}